package com.jf.thread;

import java.util.Timer;
import java.util.TimerTask;

public class CancelTimeTask extends TimerTask {
    private Timer timer;
    public CancelTimeTask(Timer timer){
        this.timer = timer;
    }
    @Override
    public void run() {
        System.out.println("结束任务！");
        timer.cancel();
    }
}
